import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
} from '@nestjs/common';
import { NodeService } from './node.service';
import { ResponseUtil } from '../common/utils/response.util';
@Controller('node')
export class NodeController {
  constructor(private readonly nodeService: NodeService) {}
  public totalUsage: any = {
    totalCpuAllocatable: '8',
    totalMemoryAllocatable: '7.69',
    totalDiskAllocatable: '14.80',
    totalCpuUsage: '0.273733797',
    totalMemoryUsage: '3.02',
    totalDiskUsage: '0',
    totalCpuUsagePercent: '3.42%',
    totalMemoryUsagePercent: '39.27%',
    totalDiskUsagePercent: '0.00%',
  };

  //获取节点总使用情况
  @Get('/getTotalUsage/:agentId')
  getTotalUsage() {
    return ResponseUtil.success(this.totalUsage);
  }

  public listNodeUsages: any = {
    list: [
      {
        name: 'federation02',
        ip: '192.168.8.30',
        cpuAllocatable: '8',
        memoryAllocatable: '7.69',
        cpuUsage: '0.313060550',
        memoryUsage: '3.03',
        nodeType: 'Master',
        status: 'Ready',
      },
      {
        name: 'federation02',
        ip: '192.168.8.30',
        cpuAllocatable: '8',
        memoryAllocatable: '7.69',
        cpuUsage: '0.313060550',
        memoryUsage: '3.03',
        nodeType: 'Master',
        status: 'Ready',
      },
      {
        name: 'federation02',
        ip: '192.168.8.30',
        cpuAllocatable: '8',
        memoryAllocatable: '7.69',
        cpuUsage: '0.313060550',
        memoryUsage: '3.03',
        nodeType: 'Master',
        status: 'Ready',
      },
      {
        name: 'federation02',
        ip: '192.168.8.30',
        cpuAllocatable: '8',
        memoryAllocatable: '7.69',
        cpuUsage: '0.313060550',
        memoryUsage: '3.03',
        nodeType: 'Master',
        status: 'Ready',
      },
      {
        name: 'federation02',
        ip: '192.168.8.30',
        cpuAllocatable: '8',
        memoryAllocatable: '7.69',
        cpuUsage: '0.313060550',
        memoryUsage: '3.03',
        nodeType: 'Master',
        status: 'Ready',
      },
      {
        name: 'federation02',
        ip: '192.168.8.30',
        cpuAllocatable: '8',
        memoryAllocatable: '7.69',
        cpuUsage: '0.313060550',
        memoryUsage: '3.03',
        nodeType: 'Master',
        status: 'Ready',
      },
      {
        name: 'federation02',
        ip: '192.168.8.30',
        cpuAllocatable: '8',
        memoryAllocatable: '7.69',
        cpuUsage: '0.313060550',
        memoryUsage: '3.03',
        nodeType: 'Master',
        status: 'Ready',
      },
      {
        name: 'federation02',
        ip: '192.168.8.30',
        cpuAllocatable: '8',
        memoryAllocatable: '7.69',
        cpuUsage: '0.313060550',
        memoryUsage: '3.03',
        nodeType: 'Master',
        status: 'Ready',
      },
      {
        name: 'federation02',
        ip: '192.168.8.30',
        cpuAllocatable: '8',
        memoryAllocatable: '7.69',
        cpuUsage: '0.313060550',
        memoryUsage: '3.03',
        nodeType: 'Master',
        status: 'Ready',
      },
      {
        name: 'federation02',
        ip: '192.168.8.30',
        cpuAllocatable: '8',
        memoryAllocatable: '7.69',
        cpuUsage: '0.313060550',
        memoryUsage: '3.03',
        nodeType: 'Master',
        status: 'Ready',
      },
      {
        name: 'federation02',
        ip: '192.168.8.30',
        cpuAllocatable: '8',
        memoryAllocatable: '7.69',
        cpuUsage: '0.313060550',
        memoryUsage: '3.03',
        nodeType: 'Master',
        status: 'Ready',
      },
    ],
    continueToken: null,
  };

  //获取节点列表使用情况
  @Post('/listNodeUsages/:agentId')
  postListNodeUsages() {
    return ResponseUtil.success(this.listNodeUsages);
  }

  // 获取节点列表
  public listNodes: any = {
    list: [
      {
        name: 'federation02',
        status: 'Ready',
        age: '22d',
        roles: ['master', 'control-plane'],
        internalIp: '192.168.8.30',
        kubeletVersion: 'v1.24.4+k3s1',
        labels: {
          'beta.kubernetes.io/arch': 'arm64',
          'beta.kubernetes.io/instance-type': 'k3s',
          'beta.kubernetes.io/os': 'linux',
          'egress.k3s.io/cluster': 'true',
          'karmada.io/etcd': '',
          'kubernetes.io/arch': 'arm64',
          'kubernetes.io/hostname': 'federation02',
          'kubernetes.io/os': 'linux',
          'node-role.kubernetes.io/control-plane': 'true',
          'node-role.kubernetes.io/master': 'true',
          'node.kubernetes.io/instance-type': 'k3s',
        },
        osImage:
          'ZTKP openEuler Embedded V4 (openEuler Embedded 24.03-LTS Distro)',
        containerRuntimeVersion: 'iSulad://2.1.5',
      },
      {
        name: 'federation03',
        status: 'Ready',
        age: '1d',
        roles: ['master', 'control-plane'],
        internalIp: '192.168.8.30',
        kubeletVersion: 'v1.24.4+k3s1',
        osImage:
          'ZTKP openEuler Embedded V4 (openEuler Embedded 24.03-LTS Distro)',
        containerRuntimeVersion: 'iSulad://2.1.5',
      },
      {
        name: 'federation04',
        status: 'Ready',
        age: '1d',
        roles: ['master', 'control-plane'],
        internalIp: '192.168.8.30',
        kubeletVersion: 'v1.24.4+k3s1',
        osImage:
          'ZTKP openEuler Embedded V4 (openEuler Embedded 24.03-LTS Distro)',
        containerRuntimeVersion: 'iSulad://2.1.5',
      },
    ],
    continueToken: null,
  };
  @Post('/listNodes/:agentId')
  postListNodes() {
    return ResponseUtil.success(this.listNodes);
  }

  // 获取节点详情
  public nodeDetail: any = {
    nodeStatus: [
      {
        type: 'MemoryPressure',
        status: 'False',
        indicator: null,
        reason: 'KubeletHasSufficientMemory',
        message: 'kubelet has sufficient memory available',
        lastHeartbeatTime: '2025-08-26T09:45:33Z',
        lastTransitionTime: '2025-08-25T09:02:45Z',
      },
      {
        type: 'DiskPressure',
        status: 'False',
        indicator: null,
        reason: 'KubeletHasNoDiskPressure',
        message: 'kubelet has no disk pressure',
        lastHeartbeatTime: '2025-08-26T09:45:33Z',
        lastTransitionTime: '2025-08-25T09:02:45Z',
      },
      {
        type: 'PIDPressure',
        status: 'False',
        indicator: null,
        reason: 'KubeletHasSufficientPID',
        message: 'kubelet has sufficient PID available',
        lastHeartbeatTime: '2025-08-26T09:45:33Z',
        lastTransitionTime: '2025-08-25T09:02:45Z',
      },
      {
        type: 'Ready',
        status: 'True',
        indicator: null,
        reason: 'KubeletReady',
        message: 'kubelet is posting ready status',
        lastHeartbeatTime: '2025-08-26T09:45:33Z',
        lastTransitionTime: '2025-08-25T09:02:55Z',
      },
    ],
    nodeEvents: [
      {
        reason: 'node',
        time: '2025-08-25T09:02:55Z',
        message: 'kubelet is posting ready status',
        count: 1,
      },
      {
        reason: 'node',
        time: '2025-08-25T09:02:55Z',
        message: 'kubelet is posting ready status',
        count: 1,
      },
      {
        reason: 'node',
        time: '2025-08-25T09:02:55Z',
        message: 'kubelet is posting ready status',
        count: 1,
      },
    ],
    nodeInfo: {
      memoryAllocatable: '7.69',
      memoryTotal: '7.69',
      ephemeralStorageAllocatable: '14.80',
      ephemeralStorageTotal: '15.58',
      podsCIDR: '10.240.0.0/24',
      ipTunnelAddr: null,
      internalIP: '192.168.8.30',
      hostname: 'federation02',
    },
    taints: [
      {
        effect: 'NoSchedule',
        key: 'environment',
        nodeName: 'prod-node-01',
        value: 'production',
      },
      {
        effect: 'NoExecute',
        key: 'resource-type',
        nodeName: 'gpu-node-02',
        value: 'gpu-high-performance',
      },
      {
        effect: 'NoExecute',
        key: 'resource-type',
        nodeName: 'gpu-node-02',
        value: 'gpu-high-performance',
      },
      {
        effect: 'NoExecute',
        key: 'resource-type',
        nodeName: 'gpu-node-02',
        value: 'gpu-high-performance',
      },
    ],
    nodeDetailUsage: {
      cpuCore: {
        allocatable: '8',
        usage: '0.274523525',
        percent: '3.43%',
      },
      cpuReq: {
        allocatable: '8',
        usage: '0.800',
        percent: '10.00%',
      },
      cpuLimit: {
        allocatable: '8',
        usage: '0',
        percent: '0.00%',
      },
      memory: {
        allocatable: '7.69',
        usage: '3.05',
        percent: '39.63%',
      },
      memoryReq: {
        allocatable: '7877.35',
        usage: '140.00',
        percent: '1.78%',
      },
      memoryLimit: {
        allocatable: '7877.35',
        usage: '170.00',
        percent: '2.16%',
      },
      podCount: {
        allocatable: '110',
        usage: '20',
        percent: '18.18%',
      },
    },
    nodeBasicInfoDTO: {
      name: 'federation02',
      createTime: '2025-08-25T09:02:46Z',
      labels: {
        'beta.kubernetes.io/arch': 'arm64',
        'beta.kubernetes.io/instance-type': 'k3s',
        'beta.kubernetes.io/os': 'linux',
        'egress.k3s.io/cluster': 'true',
        'karmada.io/etcd': '',
        'kubernetes.io/arch': 'arm64',
        'kubernetes.io/hostname': 'federation02',
        'kubernetes.io/os': 'linux',
        'node-role.kubernetes.io/control-plane': 'true',
        'node-role.kubernetes.io/master': 'true',
        'node.kubernetes.io/instance-type': 'k3s',
      },
      annotations: {
        'flannel.alpha.coreos.com/backend-data':
          '{"VNI":1,"VtepMAC":"8e:39:bf:64:05:4b"}',
        'flannel.alpha.coreos.com/backend-type': 'vxlan',
        'flannel.alpha.coreos.com/kube-subnet-manager': 'true',
        'flannel.alpha.coreos.com/public-ip': '192.168.8.30',
        'k3s.io/hostname': 'federation02',
        'k3s.io/internal-ip': '192.168.8.30',
        'k3s.io/node-args':
          '["server","--token","********","--bind-address","192.168.8.30","--advertise-address","192.168.8.30","--cluster-cidr","10.240.0.0/16","--service-cidr","10.90.0.0/16","--container-runtime-endpoint","unix:///var/run/isulad.sock"]',
        'k3s.io/node-config-hash':
          'APQIYAWF4T2Y72B7NZP6F3DGEE2LNGNSRVM3KPUCQR5NY7EGHJ2Q====',
        'k3s.io/node-env':
          '{"K3S_DATA_DIR":"/var/lib/rancher/k3s/data/8c4262cf7fdd652cccb03a99a99fdffc96d9ad41d7e57af9eb08c7ac2867c72a"}',
        'node.alpha.kubernetes.io/ttl': '0',
        'volumes.kubernetes.io/controller-managed-attach-detach': 'true',
      },
      operatingSystem: 'linux',
      architecture: 'arm64',
      operatingSystemImage:
        'ZTKP openEuler Embedded V4 (openEuler Embedded 24.03-LTS Distro)',
      osKernelVersion: '6.6.0+',
      containerRuntimeEngine: 'iSulad://2.1.5',
      kubelet: 'v1.24.4+k3s1',
      kubeProxy: 'v1.24.4+k3s1',
    },
    nodePods: [
      {
        namespace: 'kube-system',
        name: 'coredns-b96499967-7fc5q',
        status: 'Running',
        podsIp: '10.240.0.172',
        nodeName: 'federation02',
        nodeIp: null,
        containerStatuses: [
          {
            name: 'coredns',
            image:
              'f40c41555cd4d25d273942094af1267824b9d3e901fdb7c60565dcb6175955df',
            ready: true,
            restartCount: 0,
            state: 'Running',
            reason: null,
            message: null,
          },
        ],
        cpuReq: '0.100',
        cpuLimit: '0',
        memoryReq: '70.00',
        memoryLimit: '170.00',
        createTime: '2025-08-25T09:02:56Z',
      },
      {
        namespace: 'kube-system',
        name: 'local-path-provisioner-7b7dc8d6f5-kfzh7',
        status: 'Running',
        podsIp: '10.240.0.173',
        nodeName: 'federation02',
        nodeIp: null,
        containerStatuses: [
          {
            name: 'local-path-provisioner',
            image:
              'fe8bc53de6e47500407a30e6d1afaebdd813642b45d5a4ed15e849a042259bf9',
            ready: true,
            restartCount: 0,
            state: 'Running',
            reason: null,
            message: null,
          },
        ],
        cpuReq: '0',
        cpuLimit: '0',
        memoryReq: '0',
        memoryLimit: '0',
        createTime: '2025-08-25T09:02:56Z',
      },
      {
        namespace: 'kube-system',
        name: 'helm-install-traefik-crd-x8jt6',
        status: 'Succeeded',
        podsIp: '10.240.0.171',
        nodeName: 'federation02',
        nodeIp: null,
        containerStatuses: [
          {
            name: 'helm',
            image:
              'b524fed054100f225abae05029e3eb4efda71508fad3a9a32517357cf11bf7e8',
            ready: false,
            restartCount: 0,
            state: 'Terminated',
            reason: 'Completed',
            message: 'Installing helm_v3 chart\n',
          },
        ],
        cpuReq: '0',
        cpuLimit: '0',
        memoryReq: '0',
        memoryLimit: '0',
        createTime: '2025-08-25T09:02:56Z',
      },
      {
        namespace: 'kube-system',
        name: 'svclb-traefik-314dd9e3-qx22v',
        status: 'Running',
        podsIp: '10.240.0.175',
        nodeName: 'federation02',
        nodeIp: null,
        containerStatuses: [
          {
            name: 'lb-tcp-443',
            image:
              'b12bbec1f4615cea87fe3d5ba5535aefc6ee875fccc642767467293a93154aff',
            ready: true,
            restartCount: 0,
            state: 'Running',
            reason: null,
            message: null,
          },
          {
            name: 'lb-tcp-80',
            image:
              'b12bbec1f4615cea87fe3d5ba5535aefc6ee875fccc642767467293a93154aff',
            ready: true,
            restartCount: 0,
            state: 'Running',
            reason: null,
            message: null,
          },
        ],
        cpuReq: '0',
        cpuLimit: '0',
        memoryReq: '0',
        memoryLimit: '0',
        createTime: '2025-08-25T09:03:16Z',
      },
      {
        namespace: 'kube-system',
        name: 'metrics-server-668d979685-qlwml',
        status: 'Running',
        podsIp: '10.240.0.174',
        nodeName: 'federation02',
        nodeIp: null,
        containerStatuses: [
          {
            name: 'metrics-server',
            image:
              '1d64d3e888a2146b25c264f20dd929cba838bbed44082a5d3beac74c9e4b309c',
            ready: true,
            restartCount: 0,
            state: 'Running',
            reason: null,
            message: null,
          },
        ],
        cpuReq: '0.100',
        cpuLimit: '0',
        memoryReq: '70.00',
        memoryLimit: '0',
        createTime: '2025-08-25T09:02:56Z',
      },
      {
        namespace: 'kube-system',
        name: 'helm-install-traefik-wvb5j',
        status: 'Succeeded',
        podsIp: '10.240.0.170',
        nodeName: 'federation02',
        nodeIp: null,
        containerStatuses: [
          {
            name: 'helm',
            image:
              'b524fed054100f225abae05029e3eb4efda71508fad3a9a32517357cf11bf7e8',
            ready: false,
            restartCount: 2,
            state: 'Terminated',
            reason: 'Completed',
            message: 'Installing helm_v3 chart\n',
          },
        ],
        cpuReq: '0',
        cpuLimit: '0',
        memoryReq: '0',
        memoryLimit: '0',
        createTime: '2025-08-25T09:02:56Z',
      },
      {
        namespace: 'kube-system',
        name: 'traefik-7cd4fcff68-9pjdh',
        status: 'Running',
        podsIp: '10.240.0.176',
        nodeName: 'federation02',
        nodeIp: null,
        containerStatuses: [
          {
            name: 'traefik',
            image:
              '2ef507d0470ecf849d69dba8f5f48bbeb0aaef90c5fe1f2785b6ae52565f264e',
            ready: true,
            restartCount: 0,
            state: 'Running',
            reason: null,
            message: null,
          },
        ],
        cpuReq: '0',
        cpuLimit: '0',
        memoryReq: '0',
        memoryLimit: '0',
        createTime: '2025-08-25T09:03:16Z',
      },
      {
        namespace: 'karmada-system',
        name: 'etcd-0',
        status: 'Running',
        podsIp: '10.240.0.184',
        nodeName: 'federation02',
        nodeIp: null,
        containerStatuses: [
          {
            name: 'etcd',
            image:
              '9cdd6470f48c8b127530b7ce6ea4b3524137984481e48bcde619735890840ace',
            ready: true,
            restartCount: 0,
            state: 'Running',
            reason: null,
            message: null,
          },
        ],
        cpuReq: '0',
        cpuLimit: '0',
        memoryReq: '0',
        memoryLimit: '0',
        createTime: '2025-08-25T09:08:09Z',
      },
      {
        namespace: 'karmada-system',
        name: 'karmada-apiserver-56d6cfc4c8-j49cx',
        status: 'Running',
        podsIp: '10.240.0.185',
        nodeName: 'federation02',
        nodeIp: null,
        containerStatuses: [
          {
            name: 'karmada-apiserver',
            image:
              '8e49cdf98f4d1bb02b6ffdd753e549173bba453d3d476f03034be2ff8b928f43',
            ready: true,
            restartCount: 0,
            state: 'Running',
            reason: null,
            message: null,
          },
        ],
        cpuReq: '0',
        cpuLimit: '0',
        memoryReq: '0',
        memoryLimit: '0',
        createTime: '2025-08-25T09:08:11Z',
      },
      {
        namespace: 'karmada-system',
        name: 'karmada-aggregated-apiserver-687844c474-bf6rt',
        status: 'Running',
        podsIp: '10.240.0.186',
        nodeName: 'federation02',
        nodeIp: null,
        containerStatuses: [
          {
            name: 'karmada-aggregated-apiserver',
            image:
              '75768cdd23560618f0fec2cb22d11bf193e653059529b5deded705fb98bc5bb3',
            ready: true,
            restartCount: 0,
            state: 'Running',
            reason: null,
            message: null,
          },
        ],
        cpuReq: '0.100',
        cpuLimit: '0',
        memoryReq: '0',
        memoryLimit: '0',
        createTime: '2025-08-25T09:08:43Z',
      },
      {
        namespace: 'karmada-system',
        name: 'kube-controller-manager-58b95ccc77-xxdlf',
        status: 'Running',
        podsIp: '10.240.0.187',
        nodeName: 'federation02',
        nodeIp: null,
        containerStatuses: [
          {
            name: 'kube-controller-manager',
            image:
              '82966213177587406113dba7f0f5bd4181f9a47d74cf09953bf43cb521efd0f5',
            ready: true,
            restartCount: 0,
            state: 'Running',
            reason: null,
            message: null,
          },
        ],
        cpuReq: '0',
        cpuLimit: '0',
        memoryReq: '0',
        memoryLimit: '0',
        createTime: '2025-08-25T09:08:47Z',
      },
      {
        namespace: 'karmada-system',
        name: 'karmada-scheduler-55d9649d6c-zgxwl',
        status: 'Running',
        podsIp: '10.240.0.188',
        nodeName: 'federation02',
        nodeIp: null,
        containerStatuses: [
          {
            name: 'karmada-scheduler',
            image:
              '32a221ca57de57facc9623ca994adc6fef6f1718c12a8530f533e6a549d57adf',
            ready: true,
            restartCount: 0,
            state: 'Running',
            reason: null,
            message: null,
          },
        ],
        cpuReq: '0',
        cpuLimit: '0',
        memoryReq: '0',
        memoryLimit: '0',
        createTime: '2025-08-25T09:08:50Z',
      },
      {
        namespace: 'karmada-system',
        name: 'karmada-controller-manager-6cdf99bbb7-vnjw6',
        status: 'Running',
        podsIp: '10.240.0.189',
        nodeName: 'federation02',
        nodeIp: null,
        containerStatuses: [
          {
            name: 'karmada-controller-manager',
            image:
              '19e651a170d24114e8a1d657a831bcf2ab8be81c995e4bfa073ceaa98b58623e',
            ready: true,
            restartCount: 0,
            state: 'Running',
            reason: null,
            message: null,
          },
        ],
        cpuReq: '0',
        cpuLimit: '0',
        memoryReq: '0',
        memoryLimit: '0',
        createTime: '2025-08-25T09:08:52Z',
      },
      {
        namespace: 'karmada-system',
        name: 'karmada-webhook-67f6f4db8-rf8pm',
        status: 'Running',
        podsIp: '10.240.0.190',
        nodeName: 'federation02',
        nodeIp: null,
        containerStatuses: [
          {
            name: 'karmada-webhook',
            image:
              '73f221dfd3ccd03b84e2f14819a1e87c2ee3f3f84a25d59af674db8806e94337',
            ready: true,
            restartCount: 0,
            state: 'Running',
            reason: null,
            message: null,
          },
        ],
        cpuReq: '0',
        cpuLimit: '0',
        memoryReq: '0',
        memoryLimit: '0',
        createTime: '2025-08-25T09:08:54Z',
      },
      {
        namespace: 'kuboard',
        name: 'kuboard-etcd-68296',
        status: 'Running',
        podsIp: '192.168.8.30',
        nodeName: 'federation02',
        nodeIp: null,
        containerStatuses: [
          {
            name: 'etcd',
            image:
              '023a2eb58f680cd96089e05df95a8236865198db7f6c6e0c910eb325a3a80ed2',
            ready: true,
            restartCount: 0,
            state: 'Running',
            reason: null,
            message: null,
          },
        ],
        cpuReq: '0',
        cpuLimit: '0',
        memoryReq: '0',
        memoryLimit: '0',
        createTime: '2025-08-25T09:10:33Z',
      },
      {
        namespace: 'kuboard',
        name: 'kuboard-v3-775774c8c6-nf58t',
        status: 'Running',
        podsIp: '10.240.0.191',
        nodeName: 'federation02',
        nodeIp: null,
        containerStatuses: [
          {
            name: 'kuboard',
            image:
              'b15cfafcec1af321e2e366447face1ddfcc9b43ee168dd34a670f0886f572318',
            ready: true,
            restartCount: 0,
            state: 'Running',
            reason: null,
            message: null,
          },
        ],
        cpuReq: '0',
        cpuLimit: '0',
        memoryReq: '0',
        memoryLimit: '0',
        createTime: '2025-08-25T09:10:33Z',
      },
      {
        namespace: 'kuboard',
        name: 'kuboard-agent-699b887cc9-75qmn',
        status: 'Running',
        podsIp: '10.240.0.192',
        nodeName: 'federation02',
        nodeIp: null,
        containerStatuses: [
          {
            name: 'kuboard-agent',
            image:
              'e3942952cd197d6d2a48ddebc3a7162c1a72b58eb0adf25100548a59f3f4d866',
            ready: true,
            restartCount: 0,
            state: 'Running',
            reason: null,
            message: null,
          },
        ],
        cpuReq: '0',
        cpuLimit: '0',
        memoryReq: '0',
        memoryLimit: '0',
        createTime: '2025-08-25T09:12:02Z',
      },
      {
        namespace: 'kuboard',
        name: 'kuboard-agent-2-649bc875c9-wpcfb',
        status: 'Running',
        podsIp: '10.240.0.193',
        nodeName: 'federation02',
        nodeIp: null,
        containerStatuses: [
          {
            name: 'kuboard-agent',
            image:
              'e3942952cd197d6d2a48ddebc3a7162c1a72b58eb0adf25100548a59f3f4d866',
            ready: true,
            restartCount: 0,
            state: 'Running',
            reason: null,
            message: null,
          },
        ],
        cpuReq: '0',
        cpuLimit: '0',
        memoryReq: '0',
        memoryLimit: '0',
        createTime: '2025-08-25T09:12:03Z',
      },
      {
        namespace: 'karmada-system',
        name: 'karmada-dashboard-web-7f9454d85b-zg4wc',
        status: 'Running',
        podsIp: '10.240.0.195',
        nodeName: 'federation02',
        nodeIp: null,
        containerStatuses: [
          {
            name: 'karmada-dashboard-web',
            image:
              'd9a1d270bd0b25f3ce80f67d01e3536fe13b28d8107b1038c97394f8138b80d6',
            ready: true,
            restartCount: 0,
            state: 'Running',
            reason: null,
            message: null,
          },
        ],
        cpuReq: '0.250',
        cpuLimit: '0',
        memoryReq: '0',
        memoryLimit: '0',
        createTime: '2025-08-26T01:41:01Z',
      },
      {
        namespace: 'karmada-system',
        name: 'karmada-dashboard-api-6f94c69bf6-vcmqq',
        status: 'Running',
        podsIp: '10.240.0.196',
        nodeName: 'federation02',
        nodeIp: null,
        containerStatuses: [
          {
            name: 'karmada-dashboard-api',
            image:
              '31ad48722a0bc640af6027b098185170c640831ec9e01ab4f3b53b5910994f87',
            ready: true,
            restartCount: 0,
            state: 'Running',
            reason: null,
            message: null,
          },
        ],
        cpuReq: '0.250',
        cpuLimit: '0',
        memoryReq: '0',
        memoryLimit: '0',
        createTime: '2025-08-26T01:44:45Z',
      },
    ],
    images: [
      {
        name: 'alpine:3.15.1',
        sizeBytes: '5.07 MB',
      },
      {
        name: 'alpine@sha256:8e74333d4ffb48f9afdff87b06af066b39cb165a75028417f8fa069c888f7b99',
        sizeBytes: '5.07 MB',
      },
      {
        name: 'karmada/karmada-aggregated-apiserver:v1.8.0',
        sizeBytes: '89.85 MB',
      },
      {
        name: 'karmada/karmada-aggregated-apiserver@sha256:5138c1a6521263f24eb4b53ecd672318bd9774ae90a015c2be8dc0b52d062822',
        sizeBytes: '89.85 MB',
      },
      {
        name: 'karmada/karmada-controller-manager:v1.0.1',
        sizeBytes: '89.47 MB',
      },
      {
        name: 'karmada/karmada-controller-manager:v1.8.0',
        sizeBytes: '89.18 MB',
      },
      {
        name: 'karmada/karmada-controller-manager@sha256:8822da787cd5566e7599af3ba62e567da1e022c70bbe64ee0805e02610c7f0c6',
        sizeBytes: '89.18 MB',
      },
      {
        name: 'karmada/karmada-controller-manager@sha256:9b52e8d357456346116de8f14344c7d2529990a67016facd3ac90ddab1d4b826',
        sizeBytes: '89.47 MB',
      },
      {
        name: 'karmada/karmada-dashboard-api:main',
        sizeBytes: '86.08 MB',
      },
      {
        name: 'karmada/karmada-dashboard-api@sha256:0d38a0ea2ffbd51f7ca6331d4aec7510e5956154176f49d8febb071139fa774e',
        sizeBytes: '86.08 MB',
      },
      {
        name: 'karmada/karmada-dashboard-web:main',
        sizeBytes: '70.28 MB',
      },
      {
        name: 'karmada/karmada-dashboard-web@sha256:bf23722711b968e43b571121890f5785ac6ca3efe7d91accf2f127f400604be6',
        sizeBytes: '70.28 MB',
      },
      {
        name: 'karmada/karmada-metrics-adapter:latest',
        sizeBytes: '109.91 MB',
      },
      {
        name: 'karmada/karmada-metrics-adapter@sha256:0e8fbad0445e88b7976b05339b3f3b99f7786836b6105ccbf6fd9ca8fc6e561b',
        sizeBytes: '109.91 MB',
      },
      {
        name: 'karmada/karmada-scheduler:v1.8.0',
        sizeBytes: '67.31 MB',
      },
      {
        name: 'karmada/karmada-scheduler@sha256:ba2d080b7a0fd8e1b88930147b637d87f670e4294e5b454ef03aac9ec0dd7d33',
        sizeBytes: '67.31 MB',
      },
      {
        name: 'karmada/karmada-webhook:v1.8.0',
        sizeBytes: '64.92 MB',
      },
      {
        name: 'karmada/karmada-webhook@sha256:fc2d58bb9499131ef994ef04ba68d432af0c42c3d11efecbfd704f26706ae901',
        sizeBytes: '64.92 MB',
      },
      {
        name: 'kubernetesui/metrics-scraper:v1.0.8',
        sizeBytes: '40.30 MB',
      },
      {
        name: 'kubernetesui/metrics-scraper@sha256:853c43f3cced687cb211708aa0024304a5adb33ec45ebf5915d318358822e09a',
        sizeBytes: '40.30 MB',
      },
      {
        name: 'nginx:latest',
        sizeBytes: '188.73 MB',
      },
      {
        name: 'nginx@sha256:1e297dbd6dd3441f54fbeeef6be4688f257a85580b21940d18c2c11f9ce6a708',
        sizeBytes: '188.73 MB',
      },
      {
        name: 'rancher/klipper-helm:v0.7.3-build20220613',
        sizeBytes: '217.20 MB',
      },
      {
        name: 'rancher/klipper-helm@sha256:f22982a009fa6128a6bd3b0ff0b6d46dfa558fce61046c96fd316ea95253bb84',
        sizeBytes: '217.20 MB',
      },
      {
        name: 'rancher/klipper-lb:v0.3.5',
        sizeBytes: '6.97 MB',
      },
      {
        name: 'rancher/klipper-lb@sha256:f22982a009fa6128a6bd3b0ff0b6d46dfa558fce61046c96fd316ea95253bb84',
        sizeBytes: '6.97 MB',
      },
      {
        name: 'rancher/local-path-provisioner:v0.0.21',
        sizeBytes: '30.90 MB',
      },
      {
        name: 'rancher/local-path-provisioner@sha256:f22982a009fa6128a6bd3b0ff0b6d46dfa558fce61046c96fd316ea95253bb84',
        sizeBytes: '30.90 MB',
      },
      {
        name: 'rancher/mirrored-coredns-coredns:1.9.1',
        sizeBytes: '47.32 MB',
      },
      {
        name: 'rancher/mirrored-coredns-coredns@sha256:f22982a009fa6128a6bd3b0ff0b6d46dfa558fce61046c96fd316ea95253bb84',
        sizeBytes: '47.32 MB',
      },
      {
        name: 'rancher/mirrored-library-busybox:1.34.1',
        sizeBytes: '1.35 MB',
      },
      {
        name: 'rancher/mirrored-library-busybox@sha256:f22982a009fa6128a6bd3b0ff0b6d46dfa558fce61046c96fd316ea95253bb84',
        sizeBytes: '1.35 MB',
      },
      {
        name: 'rancher/mirrored-library-traefik:2.6.2',
        sizeBytes: '95.02 MB',
      },
      {
        name: 'rancher/mirrored-library-traefik@sha256:f22982a009fa6128a6bd3b0ff0b6d46dfa558fce61046c96fd316ea95253bb84',
        sizeBytes: '95.02 MB',
      },
      {
        name: 'rancher/mirrored-metrics-server:v0.5.2',
        sizeBytes: '58.02 MB',
      },
      {
        name: 'rancher/mirrored-metrics-server@sha256:f22982a009fa6128a6bd3b0ff0b6d46dfa558fce61046c96fd316ea95253bb84',
        sizeBytes: '58.02 MB',
      },
      {
        name: 'rancher/mirrored-pause:3.6',
        sizeBytes: '473.84 KB',
      },
      {
        name: 'rancher/mirrored-pause@sha256:f22982a009fa6128a6bd3b0ff0b6d46dfa558fce61046c96fd316ea95253bb84',
        sizeBytes: '473.84 KB',
      },
      {
        name: 'registry.k8s.io/etcd:3.5.9-0',
        sizeBytes: '172.39 MB',
      },
      {
        name: 'registry.k8s.io/etcd@sha256:1cf48bffb727c0e7af1bab82b3a35c5883b54ee343b2eb023eb1bebf31ec05b1',
        sizeBytes: '172.39 MB',
      },
      {
        name: 'registry.k8s.io/kube-apiserver:v1.25.4',
        sizeBytes: '117.49 MB',
      },
      {
        name: 'registry.k8s.io/kube-apiserver:v1.31.3',
        sizeBytes: '87.33 MB',
      },
      {
        name: 'registry.k8s.io/kube-apiserver@sha256:07462a1014528c044e35fc84b3a1715db5dfd9f68a07f4cb2c81ebeb5b064c43',
        sizeBytes: '117.49 MB',
      },
      {
        name: 'registry.k8s.io/kube-apiserver@sha256:e50a4d2c164fb3b9280fe6e92337861920830957d5223161f7ae1fa285b7d914',
        sizeBytes: '87.33 MB',
      },
      {
        name: 'registry.k8s.io/kube-controller-manager:v1.25.4',
        sizeBytes: '107.43 MB',
      },
      {
        name: 'registry.k8s.io/kube-controller-manager@sha256:13092d27cc7f27cfd33cdee28c581891bc6e3b5d615ffd4b3b1089dab9728d6d',
        sizeBytes: '107.43 MB',
      },
      {
        name: 'swr.cn-east-2.myhuaweicloud.com/kuboard/etcd-host:3.4.16-2',
        sizeBytes: '111.54 MB',
      },
      {
        name: 'swr.cn-east-2.myhuaweicloud.com/kuboard/etcd-host@sha256:b01e2a6621dd71b575670706dc9c8c62999628642c27ca7c43a1447af0a16e45',
        sizeBytes: '111.54 MB',
      },
      {
        name: 'swr.cn-east-2.myhuaweicloud.com/kuboard/kuboard-agent:v3',
        sizeBytes: '92.90 MB',
      },
      {
        name: 'swr.cn-east-2.myhuaweicloud.com/kuboard/kuboard-agent@sha256:f34f273e8048321d1c558e0b0db631ee6ac63b2ac7f507f32a4c710ff6f8be99',
        sizeBytes: '92.90 MB',
      },
      {
        name: 'swr.cn-east-2.myhuaweicloud.com/kuboard/kuboard:v3',
        sizeBytes: '443.66 MB',
      },
      {
        name: 'swr.cn-east-2.myhuaweicloud.com/kuboard/kuboard@sha256:fb13b6ab5aedbcdae1092e3fefa56c3718db2e145c352613037515039c114263',
        sizeBytes: '443.66 MB',
      },
    ],
  };

  @Post('/getNodeDetail/:agentId')
  postGetNodeDetail() {
    return this.nodeService.getNodeDetail();
  }

  /* 获取所有节点标签 */
  @Post('/getNodeLabels/:agentId')
  postGetAllNodesLabels() {
    return this.nodeService.getAllNodesLabels();
  }
}
